//
//  AllOrderViewController.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/7/29.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

enum OrderType {
    
    case GameOrderType
    case OneDollarType
    case GoodsOrderType
    case ReturnOrderType
    
}

class AllOrderViewController: BaseMenuController {
    
    var type : OrderType = .GoodsOrderType
    
    override func viewDidLoad() {
        super.viewDidLoad()
        

        if type == .GoodsOrderType {
            navigationItem.title = "订单管理"

        } else  if type == .GameOrderType{
            
            navigationItem.title = "游戏订单"
            
        }else  if type == .ReturnOrderType{
            
            navigationItem.title = "退款/退货"
            
        }else{
        
            navigationItem.title = "鲸喜购"

        }
        
        view.backgroundColor = UIColor.white
        
        
        setupAllChildViewController()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    func setupAllChildViewController() {
        
        if type == .GoodsOrderType  {
            let tempVC0 = OneOrderViewController()
            tempVC0.title = "全部"
            addChildViewController(tempVC0)
            
            let tempVC1 = OneOrderViewController()
            tempVC1.title = "待付款"
            tempVC1.orderType = "state_new"
            addChildViewController(tempVC1)
            
            let tempVC2 = OneOrderViewController()
            tempVC2.title = "待发货"
            tempVC2.orderType = "state_pay"
            addChildViewController(tempVC2)
            
            let tempVC3 = OneOrderViewController()
            tempVC3.title = "待收货"
            tempVC3.orderType = "state_send"
            addChildViewController(tempVC3)
            
            
            
            let tempVC4 = OneOrderViewController()
            tempVC4.title = "待评价"
            tempVC4.orderType = "state_noeval"
            addChildViewController(tempVC4)

        } else if type == .GameOrderType {
            
            let tempVC0 = GameOrderDidPayVC()
            tempVC0.title = "已付款"
            addChildViewController(tempVC0)
            
            let tempVC1 = GameOrderNoPayVC()
            tempVC1.title = "未付款"
            addChildViewController(tempVC1)
            
        } else if type == .ReturnOrderType {
            
            let tempVC0 = BaseViewController()
            tempVC0.title = "退款"
            addChildViewController(tempVC0)
            
            let tempVC1 = BaseViewController()
            tempVC1.title = "退货"
            addChildViewController(tempVC1)
            
        }else{
            
            let tempVC0 = SurprShopIngOderVC()
            tempVC0.title = "进行中"
            addChildViewController(tempVC0)
            
            let tempVC1 = SurprShopJieXiaoingVC()
            tempVC1.title = "揭晓中"
            addChildViewController(tempVC1)
            
            let tempVC2 = SurprShopDidJieXiaoVC()
            tempVC2.title = "已揭晓"
            addChildViewController(tempVC2)
            
            let tempVC3 = SurprShopWinnersVC()
            tempVC3.title = "已中奖"
            addChildViewController(tempVC3)
            
        }
        
        
    }
    

}
